<template>
    <div>
      <li v-for="item in data.list" :key="item.id">
          <input type="checkbox" v-model="item.isDone">
          <span>{{ item.title }}</span>
          <b @click="del(item.id)">X</b>
      </li>
    </div>
  </template>
  
  <script setup lang="ts">
  const data=defineProps(['list'])
  let del=(id:number)=>{
    // 找到对应下标 id===id
    let index=data.list.findIndex((item:any)=>item.id===id)
    // console.log(index);
    // 然后从list里删除对应id的数据
    data.list.splice(index,1)
  }
  </script>
  
  <style >
  </style>
  

